﻿using MES.Core;
using MES.Model.System;
using MES.Service.System.Role;
using Microsoft.AspNetCore.Mvc;

namespace MES.API.Controllers.System
{
    /// <summary>
    /// 角色管理
    /// </summary>
    [ApiVersion("1.0", Deprecated = false)]
    [Route("api/[controller]/[Action]")]
    [ApiController]
    public class RoleController : ControllerBase
    {
        private readonly IRoleService _roleService;

        public RoleController(IRoleService roleService)
        {
            _roleService = roleService;
        }


        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<OperateResult> AddRoleAsync([FromBody] Sys_Role role)
        {
            return await _roleService.AddRoleAsync(role);
        }
    }
}
